package com.jhg.drgclinicalpathway;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class JwtInterceptorConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //默认拦截所有路径
        registry.addInterceptor(authenticationInterceptor())
                .excludePathPatterns("/api/version","/api/PathForm","/files/**","/tpl/get-msg",
                        "/patient/patientinfo","/tpl/get-tpl-id","/tpl/tpl-std","/tpl/drg-weight-byid","/patient/zd2path",
                        "/patient/pat-result","/patient/warning","/tpl/PgjgDetial","/patient/proljzxqk","/chs/groupProxy",
                        "/chs/preInfo","/tpl/PgjgDetial","/patient/sync","/yb/YBJSQD","/sys/**","/api/**","/tpl/**")
                .addPathPatterns("/**");
    }
    @Bean
    public JwtAuthenticationInterceptor authenticationInterceptor() {
        return new JwtAuthenticationInterceptor();
    }
}
